package com.pro.control;

import com.pro.entity.CourseRanking;
import com.pro.entity.JsonData;
import com.pro.service.CourseRankingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName: CourseRankingController
 * @Author: 笑笑
 * @DATE: 2021/11/24
 * @TIME: 下午 04:06
 */
@RestController
@RequestMapping("/CourseRanking")
public class CourseRankingController {
    @Autowired
    private CourseRankingService courseRankingService;

    @RequestMapping("/getCountCourse")
    public JsonData getCountCourse(CourseRanking courseRanking){
        List<CourseRanking> countCourse = null;
        try {
            countCourse = courseRankingService.getCountCourse(courseRanking);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return countCourse.size() > 0 ? JsonData.buildSuccess(countCourse) : JsonData.buildError("没有查询到数据");
    }
}
